home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 34 / Amiga Format CD34 (1998-11-20)(Future Publishing)(GB)[!][Christmas issue].iso / -seriously_amiga- / programming / basic / blitzc2p / c2p / c2p060onlycls.ascii < prev    next >
Text File  |  1998-10-01  |  7KB  |  425 lines

  1. WBStartup
  2. NoCli
  3.  
  4. ; CLEARSCREEN version. Additional code by Paul West.
  5.  
  6. ; Non-clearscreen results:
  7.  
  8. ; 040/25 results:
  9.  
  10. ; 320x200 @46.0fps DoublePAL or 48.2fps PAL
  11. ; 320x256 @34.2fps DoublePAL or 37.4fps PAL
  12. ; 320x240 @37.1fps DoublePAL or 40.1fps PAL
  13.  
  14. ; 060/50 results:
  15.  
  16. ; 320x256 @50fps PAL
  17. ; 320x200 @66fps PAL
  18.  
  19. #c2pBPLX=320
  20. #c2pBPLY=256
  21. #c2pBPLSIZE=(#c2pBPLX*#c2pBPLY)/8
  22.  
  23. #scrwidth=#c2pBPLX
  24. #scrheight=#c2pBPLY
  25. #screensize=#scrwidth*#scrheight
  26.  
  27. #clearscreento=$00000000
  28.  
  29. ; c2p1x1_8_c5_060
  30.  
  31. Statement c2p060onlyinit{A.l,B.l}
  32.  
  33.   ;A.l=d0=Width.w
  34.   ;B.l=d0=Height.w
  35.  
  36. ; d0.w  chunkyx [chunky-pixels]
  37. ; d1.w  chunkyy [chunky-pixels]
  38. ; d3.w  scroffsy [screen-pixels]
  39.  
  40.   MOVEQ.l #0,d3 ; Y offset
  41.  
  42. c2p1x1_8_c5_060_init
  43.   LEA c2p_data(pc),a0
  44.   ANDI.l  #$ffff,d0
  45.   MULU.w  d0,d3
  46.   LSR.l #3,d3
  47.   MOVE.l  d3,c2p_scroffs-c2p_data(a0)
  48.   MULU.w  d0,d1
  49.   MOVE.l  d1,c2p_pixels-c2p_data(a0)
  50. AsmExit
  51. End Statement
  52.  
  53. Statement c2p060only{A.l,B.l}
  54.  
  55.   MOVE.l  d0,a0 ; Chunky
  56.   MOVE.l  d1,a1 ; Planar
  57.  
  58. ; a0  c2pscreen
  59. ; a1  bitplanes
  60.  
  61. c2p1x1_8_c5_060
  62.   MOVE.w  #_xend-_x,d0
  63.  
  64.   MOVEM.l a3-a6,-(a7)
  65.  
  66.   MOVE.l  a7,stackstore
  67.   MOVE.l  #clearscreento,a7
  68.   LEA c2p_data(pc),a2
  69.  
  70.   ADD.w #c2pBPLSIZE,a1
  71.   ADD.l c2p_scroffs-c2p_data(a2),a1
  72.  
  73.   MOVE.l  c2p_pixels-c2p_data(a2),a3
  74.   ADD.l a0,a3
  75.  
  76.   MOVE.l  a1,a2
  77.   ADD.l #c2pBPLSIZE*4,a2
  78.  
  79.   CMP.l a0,a3
  80.   BEQ _none
  81.  
  82.   MOVE.l  (a0),d0
  83.   MOVE.l  a7,(a0)+
  84.   MOVE.l  (a0),d1
  85.   MOVE.l  a7,(a0)+
  86.   MOVE.l  (a0),d2
  87.   MOVE.l  a7,(a0)+
  88.   MOVE.l  (a0),d3
  89.   MOVE.l  a7,(a0)+
  90.  
  91.   MOVE.l  #$0f0f0f0f,d5   ; Swap 4x1, parts 1 & 2
  92.   MOVE.l  d1,d6
  93.   MOVE.l  d3,d7
  94.   LSR.l #4,d6
  95.   LSR.l #4,d7
  96.   EOR.l d0,d6
  97.   EOR.l d2,d7
  98.   AND.l d5,d6
  99.   AND.l d5,d7
  100.   EOR.l d6,d0
  101.   EOR.l d7,d2
  102.   LSL.l #4,d6
  103.   LSL.l #4,d7
  104.   EOR.l d6,d1
  105.   EOR.l d7,d3
  106.  
  107.   MOVE.l  d0,a4
  108.   MOVE.l  d1,a5
  109.   MOVE.l  d2,a6
  110.   MOVE.l  d3,d5
  111.  
  112.   MOVE.l  (a0),d0
  113.   MOVE.l  a7,(a0)+
  114.   MOVE.l  (a0),d1
  115.   MOVE.l  a7,(a0)+
  116.   MOVE.l  (a0),d2
  117.   MOVE.l  a7,(a0)+
  118.   MOVE.l  (a0),d3
  119.   MOVE.l  a7,(a0)+
  120.  
  121.   MOVE.l  d1,d6     ; Swap 4x1, parts 3 & 4
  122.   MOVE.l  d3,d7
  123.   LSR.l #4,d6
  124.   LSR.l #4,d7
  125.   EOR.l d0,d6
  126.   EOR.l d2,d7
  127.   AND.l #$0f0f0f0f,d6
  128.   AND.l #$0f0f0f0f,d7
  129.   EOR.l d6,d0
  130.   EOR.l d7,d2
  131.   LSL.l #4,d6
  132.   LSL.l #4,d7
  133.   EOR.l d6,d1
  134.   EOR.l d7,d3
  135.  
  136.   EXG d1,a4
  137.   EXG d3,a6
  138.  
  139.   MOVE.w  d0,d6     ; Swap 16x4, parts 1 & 3
  140.   MOVE.w  d2,d7
  141.   MOVE.w  d1,d0
  142.   MOVE.w  d3,d2
  143.   SWAP  d0
  144.   SWAP  d2
  145.   MOVE.w  d0,d1
  146.   MOVE.w  d2,d3
  147.   MOVE.w  d6,d0
  148.   MOVE.w  d7,d2
  149.  
  150.   BRA _start
  151. _x
  152.   MOVE.l  (a0),d0
  153.   MOVE.l  a7,(a0)+
  154.   MOVE.l  (a0),d1
  155.   MOVE.l  a7,(a0)+
  156.   MOVE.l  (a0),d2
  157.   MOVE.l  a7,(a0)+
  158.   MOVE.l  (a0),d3
  159.   MOVE.l  a7,(a0)+
  160.  
  161.   MOVE.l  d7,c2pBPLSIZE*2(a1)
  162.  
  163.   MOVE.l  #$0f0f0f0f,d5   ; Swap 4x1, parts 1 & 2
  164.   MOVE.l  d1,d6
  165.   MOVE.l  d3,d7
  166.   LSR.l #4,d6
  167.   LSR.l #4,d7
  168.   EOR.l d0,d6
  169.   EOR.l d2,d7
  170.   AND.l d5,d6
  171.   AND.l d5,d7
  172.   MOVE.l  a6,-c2pBPLSIZE(a1)
  173.   EOR.l d6,d0
  174.   EOR.l d7,d2
  175.   LSL.l #4,d6
  176.   LSL.l #4,d7
  177.   EOR.l d6,d1
  178.   EOR.l d7,d3
  179.  
  180.   MOVE.l  a5,d7
  181.  
  182.   MOVE.l  d0,a4
  183.   MOVE.l  d1,a5
  184.   MOVE.l  d2,a6
  185.   MOVE.l  d3,d5
  186.  
  187.   MOVE.l  (a0),d0
  188.   MOVE.l  a7,(a0)+
  189.   MOVE.l  (a0),d1
  190.   MOVE.l  a7,(a0)+
  191.   MOVE.l  (a0),d2
  192.   MOVE.l  a7,(a0)+
  193.   MOVE.l  (a0),d3
  194.   MOVE.l  a7,(a0)+
  195.  
  196.   MOVE.l  d7,(a1)+
  197.  
  198.   MOVE.l  d1,d6     ; Swap 4x1, parts 3 & 4
  199.   MOVE.l  d3,d7
  200.   LSR.l #4,d6
  201.   LSR.l #4,d7
  202.   EOR.l d0,d6
  203.   EOR.l d2,d7
  204.   AND.l #$0f0f0f0f,d6
  205.   AND.l #$0f0f0f0f,d7
  206.   EOR.l d6,d0
  207.   EOR.l d7,d2
  208.   LSL.l #4,d6
  209.   LSL.l #4,d7
  210.   EOR.l d6,d1
  211.   EOR.l d7,d3
  212.  
  213.   EXG d1,a4
  214.   EXG d3,a6
  215.  
  216.   MOVE.w  d0,d6     ; Swap 16x4, parts 1 & 3
  217.   MOVE.w  d2,d7
  218.   MOVE.w  d1,d0
  219.   MOVE.w  d3,d2
  220.   SWAP  d0
  221.   SWAP  d2
  222.   MOVE.w  d0,d1
  223.   MOVE.w  d2,d3
  224.   MOVE.w  d6,d0
  225.   MOVE.w  d7,d2
  226.  
  227.   MOVE.l  d4,c2pBPLSIZE-4(a1)
  228. _start
  229.   MOVE.l  #$33333333,d4   ; Swap 2x4, parts 1 & 3
  230.   MOVE.l  d0,d6
  231.   MOVE.l  d2,d7
  232.   LSR.l #2,d6
  233.   LSR.l #2,d7
  234.   EOR.l d1,d6
  235.   EOR.l d3,d7
  236.   AND.l d4,d6
  237.   AND.l d4,d7
  238.   EOR.l d6,d1
  239.   EOR.l d7,d3
  240.   LSL.l #2,d6
  241.   LSL.l #2,d7
  242.   EOR.l d6,d0
  243.   EOR.l d7,d2
  244.  
  245.   MOVE.l  #$00ff00ff,d4   ; Swap 8x2, parts 1 & 3
  246.   MOVE.l  d2,d6
  247.   MOVE.l  d3,d7
  248.   LSR.l #8,d6
  249.   LSR.l #8,d7
  250.   EOR.l d0,d6
  251.   EOR.l d1,d7
  252.   AND.l d4,d6
  253.   AND.l d4,d7
  254.   EOR.l d6,d0
  255.   EOR.l d7,d1
  256.   LSL.l #8,d6
  257.   LSL.l #8,d7
  258.   EOR.l d6,d2
  259.   EOR.l d7,d3
  260.  
  261.   MOVE.l  #$55555555,d4   ; Swap 1x2, parts 1 & 3
  262.   MOVE.l  d2,d6
  263.   MOVE.l  d3,d7
  264.   LSR.l #1,d6
  265.   LSR.l #1,d7
  266.   EOR.l d0,d6
  267.   EOR.l d1,d7
  268.   AND.l d4,d6
  269.   AND.l d4,d7
  270.   EOR.l d6,d0
  271.   EOR.l d7,d1
  272.   MOVE.l  d1,c2pBPLSIZE*2(a2)
  273.   ADD.l d6,d6
  274.   ADD.l d7,d7
  275.   EOR.l d6,d2
  276.   EOR.l d7,d3
  277.  
  278.   EXG a5,d0
  279.   EXG d5,d1
  280.   EXG a4,d2
  281.   EXG a6,d3
  282.  
  283.   MOVE.w  d2,d6     ; Swap 16x4, parts 2 & 4
  284.   MOVE.w  d3,d7
  285.   MOVE.w  d0,d2
  286.   MOVE.w  d1,d3
  287.   SWAP  d2
  288.   SWAP  d3
  289.   MOVE.l  a6,c2pBPLSIZE(a2)
  290.   MOVE.w  d2,d0
  291.   MOVE.w  d3,d1
  292.   MOVE.w  d6,d2
  293.   MOVE.w  d7,d3
  294.  
  295.   MOVE.l  #$33333333,d4   ; Swap 2x4, parts 2 & 4
  296.   MOVE.l  d2,d6
  297.   MOVE.l  d3,d7
  298.   LSR.l #2,d6
  299.   LSR.l #2,d7
  300.   EOR.l d0,d6
  301.   EOR.l d1,d7
  302.   AND.l d4,d6
  303.   AND.l d4,d7
  304.   EOR.l d6,d0
  305.   EOR.l d7,d1
  306.   LSL.l #2,d6
  307.   LSL.l #2,d7
  308.   MOVE.l  a5,(a2)+
  309.   EOR.l d6,d2
  310.   EOR.l d7,d3
  311.  
  312.   MOVE.l  #$00ff00ff,d4   ; Swap 8x2, parts 2 & 4
  313.   MOVE.l  d1,d6
  314.   MOVE.l  d3,d7
  315.   LSR.l #8,d6
  316.   LSR.l #8,d7
  317.   EOR.l d0,d6
  318.   EOR.l d2,d7
  319.   AND.l d4,d6
  320.   AND.l d4,d7
  321.   EOR.l d6,d0
  322.   EOR.l d7,d2
  323.   LSL.l #8,d6
  324.   LSL.l #8,d7
  325.   MOVE.l  a4,-c2pBPLSIZE-4(a2)
  326.   EOR.l d6,d1
  327.   EOR.l d7,d3
  328.  
  329.   MOVE.l  #$55555555,d4   ; Swap 1x2, parts 2 & 4
  330.   MOVE.l  d1,d6
  331.   MOVE.l  d3,d7
  332.   LSR.l #1,d6
  333.   LSR.l #1,d7
  334.   EOR.l d0,d6
  335.   EOR.l d2,d7
  336.   AND.l d4,d6
  337.   AND.l d4,d7
  338.   EOR.l d6,d0
  339.   EOR.l d7,d2
  340.   ADD.l d6,d6
  341.   ADD.l d7,d7
  342.   EOR.l d6,d1
  343.   EOR.l d7,d3
  344.  
  345.   MOVE.l  d0,d7
  346.   MOVE.l  d1,d4
  347.   MOVE.l  d2,a5
  348.   MOVE.l  d3,a6
  349.  
  350.   CMP.l a0,a3
  351.   BNE _x
  352. _xend
  353.  
  354.   MOVE.l  d7,c2pBPLSIZE*2(a1)
  355.   MOVE.l  d4,c2pBPLSIZE(a1)
  356.   MOVE.l  a5,(a1)+
  357.   MOVE.l  a6,-c2pBPLSIZE-4(a1)
  358. _none
  359.   MOVE.l  stackstore(pc),a7
  360.   MOVEM.l (a7)+,a3-a6
  361. AsmExit
  362.  
  363.   Even4
  364. stackstore: Dc.l 0
  365. c2p_data
  366. c2p_screen: Dc.l 0
  367. c2p_scroffs: Dc.l 0
  368. c2p_pixels: Dc.l 0
  369.   Ds.l  16
  370. End Statement
  371.  
  372.  
  373.  
  374.  
  375. .blitzprogram
  376. ; Setup
  377. InitBank 0,(#scrwidth*#scrheight)+1000,2|65536 ; Chipram planar buffer
  378. CludgeBitMap 0,#scrwidth,#scrheight,8,Bank(0)
  379. InitPalette 0,256
  380. For c=0 To 255
  381.   AGAPalRGB 0,c,Rnd(c),Rnd(c),Rnd(c)
  382. Next c
  383. AGAPalRGB 0,0,0,0,0
  384. Screen 0,0,0,#scrwidth,#scrheight,8,0,"c2p test",0,0,0
  385. Use Palette 0
  386. VWait 50
  387. baseaddress1.l=AllocMem(#scrwidth*#scrheight,$10000) ; Fastram chunky buffer
  388.  
  389. ; Put something into the chunky buffer so we can see it working
  390. GetReg a0,baseaddress1
  391. MOVE.l  #0,d0
  392. MOVE.l  #screensize-1,d1
  393. cloop
  394.   MOVE.b  d0,(a0)+
  395.   ADDQ.l  #1,d0
  396.   SUBQ.l  #1,d1
  397.   TST.l   d1
  398.   BLT     done
  399.   BRA     cloop
  400. done
  401.  
  402. ; Do the c2p test
  403. c2p060onlyinit{#scrwidth,#scrheight}
  404. VWait 20
  405. Forbid_
  406. VWait
  407. ResetTimer
  408. For time=1 To 800
  409.   c2p060only{baseaddress1,Bank(0)} ; Convert chunky to planar
  410. Next time
  411. t=Ticks
  412. VWait 2 : Permit_
  413. VWait 20
  414. FindScreen 0
  415. Window 0,0,11,640,100,0,"Test results for c2p",0,0
  416. WindowOutput 0
  417. NPrint "Routine performed @ ",50/(t/800),"fps - ",t," ticks"
  418. NPrint " "
  419. NPrint "Press mousebutton..."
  420. Free Screen 0
  421. MouseWait
  422. Free Window 0
  423. End
  424.  
  425.